package com.milo.xstream;

import com.milo.xstream.outxml.AlipayXmlOutMessage;
import com.milo.xstream.xml.AlipayXmlMessage;

/**
 * @author milogenius
 * @date 2020-04-03 15:49
 */
public class XmlDemoTest {

    public static void main(String[] args) {
        //xml --->pojo
        String bizContent = "<XML>\n" +
                "    <AppId><![CDATA[2014070100171523]]></AppId>\n" +
                "    <FromUserId><![CDATA[20882837462837462837462837461234]]></FromUserId>\n" +
                "    <FromAlipayUserId><![CDATA[2088283746283746]]></FromAlipayUserId>\n" +
                "    <CreateTime><![CDATA[1405943673657]]></CreateTime>\n" +
                "    <MsgType><![CDATA[event]]></MsgType>\n" +
                "    <EventType><![CDATA[follow]]></EventType>\n" +
                "    <ActionParam><![CDATA[{\"scene\":{\"sceneId\": \"1234\"}}]]></ActionParam>\n" +
                "    <AgreementId><![CDATA[]]></AgreementId>\n" +
                "    <AccountNo><![CDATA[]]></AccountNo>\n" +
                "    <UserInfo><![CDATA[{\"logon_id\":\"135****1009\",\"user_name\":\"*iuxu527\"}]]></UserInfo>\n" +
                "</XML>";
        AlipayXmlMessage alipayXmlMessage = AlipayXmlMessage.fromXml(bizContent);
       //System.out.println(alipayXmlMessage);



        //pojo --->xml
        AlipayXmlOutMessage mpXmlOutMessage = AlipayXmlOutMessage.ACK().toUserId("123456").appId("99999999").build();
        String xml = mpXmlOutMessage.toXml();
        System.out.println(xml);

    }
}
